knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(tidyverse) library(EveryCityCanada)
As input we need a city as returned by cancensus list_census_regions.
cities=not_tweeted_cities_list() city <- dplyr::sample_n(cities,1) paste0(city$name," (",city$municipal_status,"), Population: ",scales::comma(city$pop))
To get the plot for the city we call the every_city_plot function. Gathering the data and drawing the vector map can take a little bit of time.
image_path=every_city_plot(city) browseURL(image_path)
To tweet out a random city use the send_every_city_tweet function. Optionally specify the city to send out a tweet for a specific city.
send_every_city_tweet(city,tweeted_cities_path=file.path("..","data","tweeted_cities"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.